using System;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace SmallBasicFun.Tests
{
    [TestClass]
    public class TortoiseTest
    {
        [TestMethod]
        public void TestArchive()
        {
            string path = "testArchive.txt";
            File.WriteAllText(path, "one");
            var date = new DateTime(2010, 1, 2, 11, 20, 8);
            string archivedFile = FileSystemCapture.ArchiveFile(path, date);
            string expected = "archive\\testArchive.2010_01_02_11_20_08.txt";
            Assert.IsTrue(File.Exists(expected), "moved to - " + archivedFile);
        }

        [TestMethod]
        public void TestArchiveEmpty()
        {
            string path = "this_file_does_not_exist.ever";
            var date = new DateTime(2010, 1, 2, 11, 20, 8);
            string archivedFile = FileSystemCapture.ArchiveFile(path, date);
            Assert.IsNull(archivedFile);
        }

        [TestMethod]
        public void TestTortoiseIsCentered()
        {
            var turtle = new MyTurtle(7);
            MyTurtle.forceAnimateTime = 0;
            turtle.Move(100);
            ApprovalHelper.ApproveProgramWindow();
        }

        [TestMethod]
        public void TestTortoiseHideAndShow()
        {
            Tortoise.Show();
            Tortoise.Move(16);
            Tortoise.Turn(45);
            Tortoise.MoveTo(200, 200);
            Tortoise.MoveTo(280, 220);
            Tortoise.Hide();
            Tortoise.Show();
            ApprovalHelper.ApproveProgramWindow();
        }
    }
}